package com.thauanLopes.bacterium.GameManages;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Align;

import com.game.ThauanFramework.Util;
import com.game.ThauanFramework.SaveManager;

public class CashManager {
	
	private final String TAG = "Cash Manager";
	
	private static CashManager instance;
	public static CashManager getInstance()
	{
		if(instance == null)
			instance = new CashManager();
		
		return instance;
	}
	
	// -=-=--=-==-=--=-=-=-=-=-=-=-=-=--=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
	private int cash;
	public static String FOR_SAVE_MONEY = "com.thauanlopes.bacterium.money";
	
	private int x;
	private int y = 30;
	
	private Paint paint;
	private int textSize = 20;
	
	private CashManager()
	{
		this.cash = SaveManager.getInstance().LoadInt(CashManager.FOR_SAVE_MONEY);
		
		this.paint = new Paint();
		this.paint.setTextAlign(Align.RIGHT);
		this.paint.setTextSize(textSize);
		
		this.x = Util.getCanvasWidth() - 10;
	}
	
	public void Update(double deltaTime)
	{
		
	}
	public void Draw(Canvas canvas)
	{
		canvas.drawText( String.valueOf(cash) + "$ ", x, y, this.paint);
	}
	
	public void AddCash(int much)
	{
		this.cash += much;
		SaveManager.getInstance().SaveInt(CashManager.FOR_SAVE_MONEY, this.cash);
	}
	
}
